import request from '@/utils/system/request'

// 通过角色id保存授权接口
export function saveResourceByRoleId(roleId: string, data: object) {
	return request({
		url: `/sys/resource/${roleId}`,
		method: 'post',
		data
	})
}

// 获取数据api
export function getData(service: string, controller: string) {
	return request({
		url: `/sys/resource/list/${service}/${controller}`,
		method: 'get'
	})
}

// 获取数据api
export function getService() {
	return request({
		url: `/sys/resource/service`,
		method: 'get',
	})
}

// 获取数据api
export function resourceIdsByRoleId(roleId: string) {
	return request({
		url: `/sys/resource/${roleId}`,
		method: 'get',
	})
}

// 更新数据
export function update(data: object) {
	return request({
		url: `/sys/resource`,
		method: 'put',
		data
	})
}

export function add(data: object) {
	return request({
		url: `/sys/resource/add`,
		method: 'post',
		data
	})
}



